package com.demo.lifeinfo.app;

import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;

import com.demo.lifeinfo.model.MediaLoader;
import com.scwang.smartrefresh.header.MaterialHeader;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator;
import com.scwang.smartrefresh.layout.api.RefreshHeader;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.yanzhenjie.album.Album;
import com.yanzhenjie.album.AlbumConfig;

import cn.bmob.v3.Bmob;

/**
 * created by Raymond
 * on 2019-04-23
 */
public class MyApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        //bmob初始化
        Bmob.initialize(this, "553807ca7f3b5203741c68c43619216f");

        Album.initialize(AlbumConfig.newBuilder(this)
                .setAlbumLoader(new MediaLoader())
                .build());
    }

    static {
        SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
            @NonNull
            @Override
            public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) {
                return new MaterialHeader(context);
            }
        });

    }
}
